from django.db import models

# Create your models here.
class Author(models.Model):
    first_name = models.CharField(max_length=32)
    last_name = models.CharField(max_length=32)
    email = models.EmailField()
    def __str__(self):
        return "%s--%s" %(self.first_name,self.last_name,)
class Publisher(models.Model):
    name = models.CharField(max_length=32,unique=True)
    city = models.CharField(max_length=32,)
    country = models.CharField(max_length=32,)
    website = models.URLField(max_length=32,)
    def __str__(self):
        return "%s" %(self.name)
class Book(models.Model):
    name = models.CharField(max_length=32,)
    author = models.ManyToManyField(Author)
    publisher = models.ForeignKey(Publisher)
    publisher_date = models.DateField(auto_now_add=True)
    def __str__(self):
        return "%s--%s" %(self.name,self.publisher_date)